home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / cnet / Greed2_0.lha / Greed / _GreedMaint < prev    next >
Text File  |  1995-05-11  |  3KB  |  146 lines

  1. /* $VER: GreedMaint 2.0.2 (5/2/95) by Spike Dethman
  2. */
  3. /******************************/
  4. /*   auto-maint module for    */
  5. /*   Greed2.0 P-file.         */
  6. /*   Set-up to run once per   */
  7. /*   week to reset game and   */
  8. /*   award bonus to winners.  */
  9. /******************************/
  10.  
  11. options results ; signal on SYNTAX ; signal on ERROR ; signal on IOERR
  12. tr = transmit ; gu = getuser
  13.  
  14. bonuscred=100000 ; /*  <<< byte creds awarded to week's winners  */
  15. bonusfiles=2 ; /*  <<< file credits awarded to winners */
  16.  
  17. call GetPaths
  18.  
  19. INIT:
  20. tr 'MAINT RUNNING:  Updating GREED winners...'
  21. logentry ('Greed 2.0 reset to new game.')
  22. gu 12 ; enddate=left(result,15)
  23.  
  24. tr '  Creating new '||NewsFile||'...'
  25. call open(f1,NewsFile,'w')
  26. call writeln(f1,'caGREED Winners----------cc')
  27. call writeln(f1,'For the week ending '||enddate||':')
  28. call writeln(f1,'')
  29.  
  30. fn='GreedFive' ; call GETWIN
  31. tr '    Full Game Winner='||winner
  32. if winner~=0 then do ;
  33.    call WINBONUS ; call MAILWIN ;
  34. end
  35.  
  36. tr '  Clearing hi-scores.'
  37. call CLEARHI
  38. call writeln(f1,'cfTop Full Game Winner:    '||winhandle)
  39. call writeln(f1,'Score='||winscore)
  40. call writeln(f1,'')
  41.  
  42. fn='GreedFive-sh' ; call GETWIN
  43. tr '     Single Hand Winner='||winner
  44. if winner~=0 then do ;
  45.    call WINBONUS ; call MAILWIN ;
  46. end
  47.  
  48. tr 'Clearing sh-scores.'
  49. call CLEARHI
  50. call writeln(f1,'cbTop Single Hand Winner:  '||winhandle)
  51. call writeln(f1,'Score='||winscore)
  52. call writeln(f1,'')
  53.  
  54. if bonuscred>0 then do
  55.    call writeln(f1,'ccThey Got '||bonuscred||' Credits for Being the GREEDIEST!')
  56.    call writeln(f1,'')
  57. end
  58.  
  59. call writeln(f1,'cfCongrats!')
  60. call writeln(f1,'')
  61. call writeln(f1,'c9A New Game Has Been Started!')
  62. call writeln(f1,'Will you be caGREEDYc9 this week, v1}?')
  63. call close(f1)
  64. tr 'News created.'
  65.  
  66. /* Write new news date for login mod */
  67. f4='date' ; call open(f4,GreedPath||'GreedNewsDate','w')
  68. gu 12 ; date=result
  69. call writeln(f4,date)
  70. call close(f4)
  71. tr 'Updated News date - GreedMaint successful!'
  72. exit
  73. /*  All Done!! */
  74.  
  75.  
  76. GETWIN:
  77. f2=score
  78. call open(f2,GreedPath||fn,'r')
  79. winhandle=readln(f2)
  80. winscore=readln(f2)
  81. winner=readln(f2)
  82. if winner=0 then winhandle='r1 Nobody this time! r0'
  83. call close(f2)
  84.  
  85. return
  86.  
  87.  
  88. WINBONUS:
  89. winname=''
  90. loadscratch (winner) ; if result=0 then return
  91. getscratch (3) ; winname=result
  92.  
  93. if bonuscred=0 then return
  94.  
  95. getscratch (35) ; cred=result
  96. cred=cred+bonuscred ; setobject cred
  97. putscratch (35)
  98. getscratch (34) ; cred=result
  99. cred=cred+bonusfiles ; setobject cred
  100. putscratch (34)
  101. savescratch (winner)
  102.  
  103. tr '     Awarded '||bonuscred||' credits, '||bonusfiles||' files.'
  104. logentry (winname||' awarded '||bonuscred||' credits.')
  105.  
  106. return
  107.  
  108.  
  109. MAILWIN:
  110. call open(f3,GreedPath||'Greed Mail','w')
  111. call writeln(f3,'ccYou Were the TOP caGREEDcc Player This Week!')
  112. call writeln(f3,'With a score of: '||winscore||'!')
  113.  
  114. if bonuscred>0 then do
  115.    call writeln(f3,'')
  116.    call writeln(f3,'cbYou WON '||bonuscred||' Credits!')
  117. end
  118.  
  119. call writeln(f3,'')
  120. call writeln(f3,'cfCongrats, '||winname||', you GREEDY thing!')
  121. call close(f3)
  122.  
  123. loadeditor (GreedPath||'Greed Mail')
  124. setmailsubj ('Congratulations!')
  125. writemail (winner)
  126.  
  127. tr '     Sent congratulatory mail.'
  128. return
  129.  
  130.  
  131. CLEARHI:
  132. call open(f2,GreedPath||fn,'w')
  133. do x=1 to 5
  134.    call writeln(f2,"Nobody Yet!") ; call writeln(f2,"0") ; call writeln(f2,"0")
  135. end x ; call close(f2)
  136. return
  137.  
  138. SYNTAX:
  139. ERROR:
  140. IOERR:
  141. tr 'Error encountered at line '||sigl||' of GreedMaint.'
  142. logentry ('Error at line '||sigl||' of GreedMaint.')
  143. bufferflush ; exit
  144.  
  145. GetPaths:
  146.